home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / database / clippc / up.prg < prev   
Text File  |  1988-03-03  |  2KB  |  66 lines

  1. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2. *  File: Up.prg
  3. *
  4. *  Author: Mark Pfeifer
  5. *
  6. *  Compiler:  Clipper (tm), Summer '87
  7. *
  8. *  Revision:
  9. *     6-Jul-87    initial coding in Autumn '86
  10. *     2-Mar-88    optimization for Summer '87
  11. *
  12. *  Copyright: none, placed in the public domain by author
  13. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  14.  
  15. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  16. * func UpEq
  17. *
  18. *   syntax:   UpEq(<exp-C1>,<exp-C2>[,<exp-C3>,...,<exp-C11>])
  19. *      where:
  20. *         <exp-C1>              primary string
  21. *         <exp-C2>...<exp-C11>  secondary strings
  22. *   returns:
  23. *       logical .T. if any of the secondary strings are equal to the
  24. *       primary string, logical .F. otherwise.  Note: both primary and
  25. *       secondary strings are converted to uppercase before comparison.
  26. *       In addition, secondary strings are Trimmed.
  27. *
  28. *       Examples
  29. *          UpEq("Hello","Hel")      .T.
  30. *          UpEq("Hello","hel")      .T.
  31. *          UpEq("Hello","hEL    ")  .T.
  32. *          UpEq("Hello","GoodBye","Hi")        .F.
  33. *          UpEq("Hello","GoodBye","Hi","H")    .T.
  34. *
  35.  
  36. func UpEq
  37. para pStr,p0,p1,p2,p3,p4,p5,p6,p7,p8,p9
  38.  
  39.  
  40.    priv mMax        && Max # of secondary parameter
  41.    mMax=PCount()-2  && max number of secondary strings
  42.  
  43.    priv mRet      && value to be returned
  44.    mRet=.F.
  45.  
  46.    pStr=Upper(pStr)  && note that this won't change the passed parameter
  47.  
  48.    priv mCnt,;    && loop counter
  49.         mPar      && secondary parameter being processed
  50.  
  51.    for mCnt = 0 to mMax
  52.  
  53.       mPar=AlphaN(mCnt)
  54.  
  55.       if pStr=Upper(Trim(p&mPar))
  56.          mRet=.T.
  57.          exit
  58.       endif
  59.  
  60.    next mCnt
  61.  
  62. retu mRet
  63.  
  64. * end of func UpEq
  65. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  66.